home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Ports / alfa / alfa.h next >
Encoding:
C/C++ Source or Header  |  1990-10-21  |  3.6 KB  |  122 lines  |  [TEXT/????]

  1. /* TERMCAP STDWIN -- INTERNAL HEADER FILE */
  2.  
  3. /* BEWARE: CONFUSED COORDINATE CONVENTIONS.
  4.    The VTRM package, used here for terminal output,
  5.    puts the y coordinate first.
  6.    The stdwin package itself puts the x coordinate first
  7.    (but instead of (x, y), it uses (h, v)).
  8.    Also, when VTRM specifies a range of lines, the second number
  9.    is the last line included.  In stdwin, the second number is
  10.    the first position NOT included. */
  11.  
  12. #include "tools.h"
  13. #include "stdwin.h"
  14. #include "menu.h"
  15. #include "vtrm.h"
  16.  
  17. struct _window {
  18.     short tag;        /* Window tag, usable as document id */
  19.     short open;        /* Set if this struct window is in use */
  20.     char *title;        /* Title string */
  21.     void (*drawproc)();    /* Draw procedure */
  22.     short top;        /* Top line on screen */
  23.     short bottom;        /* Bottom line on screen + 1 */
  24.     int offset;        /* Diff. between doc. and screen line no's */
  25.     int curh, curv;        /* Text cursor position (doc. coord.) */
  26.     TEXTATTR attr;        /* Text attributes */
  27.     struct menubar mbar;    /* Collection of local menus */
  28.     long timer;        /* Absolute timer value (see timer.c) */
  29.     short resized;        /* Nonzero when resize event pending */
  30. };
  31.  
  32. /* Note on the meaning of the 'offset' field:
  33.    to convert from screen coordinates to document coordinates: add offset;
  34.    from document coordinates to screen coordinates: subtract offset. */
  35.  
  36. /* Data structures describing windows. */
  37.  
  38. #define MAXWINDOWS    20
  39. #define MAXLINES    120
  40.  
  41. extern WINDOW winlist[MAXWINDOWS];
  42. extern char uptodate[MAXLINES];
  43. extern WINDOW *wasfront, *front, *syswin;
  44. extern int lines, columns;
  45. extern TEXTATTR wattr;
  46.  
  47. /* KEY MAPPING. */
  48.  
  49. /* The primary key map is a 256-entry array indexed by the first
  50.    character received.  Secondary key maps are lists terminated with a
  51.    type field containing SENTINEL.
  52.    The maps use the same data structure so they can be processed
  53.    by the same routine. */
  54.  
  55. struct keymap {
  56.     unsigned char key;    /* Character for which this entry holds */
  57.     unsigned char type;    /* Entry type */
  58.     unsigned char id;    /* Id and item of menu shortcut */
  59.     unsigned char item;    /* Also parameter for other types */
  60. };
  61.  
  62. /* Entry types: */
  63. #define ORDINARY    0    /* Report char as itself */
  64. #define SECONDARY    1    /* Proceed to secondary keymap [id] */
  65. #define SHORTCUT    2    /* Menu shortcut */
  66. #define SENTINEL    127    /* End of secondary key map */
  67.  
  68. extern struct keymap _wprimap[256];
  69. extern struct keymap **_wsecmap;
  70.  
  71. #define SECMAPSIZE 128
  72.  
  73. /* The system menu (menu id 0) has a few entries for window manipulation,
  74.    followed by entries corresponding to WE_COMMAND subcodes.
  75.    WC_CLOSE happens to be the first of those, and corresponds
  76.    with CLOSE_WIN. */
  77.  
  78. /* Item numbers in system menu: */
  79. #define PREV_WIN    0
  80. #define NEXT_WIN    1
  81. #define CLOSE_WIN    2
  82.  
  83. /* Offsets between WE_COMMAND subcodes and item numbers in system menu: */
  84. #define FIRST_CMD    (CLOSE_WIN - WC_CLOSE)
  85. #define LAST_CMD    99
  86.  
  87. /* There are also some codes that have a shortcut and a special interpretation
  88.    but no entry in the system menu: */
  89. #define SUSPEND_PROC    100
  90. #define REDRAW_SCREEN    101
  91. #define MOUSE_DOWN    102
  92. #define MOUSE_UP    104
  93. #define LITERAL_NEXT    105
  94.  
  95. #define MENU_CALL    127    /* Start interactive menu selection */
  96.  
  97. void wsyscommand();
  98. bool wsysevent();
  99. void wmenuselect();
  100. void wdrawtitle();
  101. void wnewshortcuts();
  102. void wgoto();
  103. void _wselnext();
  104. void _wselprev();
  105. void _wredraw();
  106. void _wsuspend();
  107. void getbindings();
  108. void initsyswin();
  109. void drawmenubar();
  110. void drawlocalmenubar();
  111. void _wreshuffle();
  112. void _wnewtitle();
  113. void wsysdraw();
  114. void killmenubar();
  115. void initmenubar();
  116. void gettckeydefs();
  117. void getttykeydefs();
  118. void wsetmetakey();
  119. void menubarchanged();
  120. void menuselect();
  121. void _wlitnext();
  122.